package acm.europe2005.central;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

/*
 * p2429
 * ACM ICPC - Central European 2005
 */

public class p2429 {

	static int n,m;
	static int[] count;
	static String s;
	static Map<String, Integer> map;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		do {
			n = scanner.nextInt();
			m = scanner.nextInt();
			if (n == 0 && m == 0) {
				break;
			}
			map = new TreeMap<String, Integer>();

			for (int i=0;i<n;++i) {
				s = scanner.next();
				if (map.containsKey(s)) {
					int n = map.get(s);
					map.put(s, n+1);
				}
				else {
					map.put(s, 1);
				}
			}
			count = new int[n];

			Object[] objs = map.keySet().toArray();
			for (int i=0;i<objs.length;++i) {
				s = (String)objs[i];
				int f = map.get(s);
				count[f-1]++;
			}
			
			for (int i=0;i<n;++i) {
				System.out.println(count[i]);
			}
		} while (true);
	}

}